package com.xiaojian.blog.controller.admin;

import com.xiaojian.blog.controller.BaseController;
import com.xiaojian.blog.dto.Types;
import com.xiaojian.blog.model.MetaPO;
import com.xiaojian.blog.service.MetaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 友链管理controller
 */
@Controller
@RequestMapping("admin/links")
public class LinksController extends BaseController {

    private static final Logger LOGGER = LoggerFactory.getLogger(LinksController.class);

    @Resource
    private MetaService metaService;

    @GetMapping(value = "")
    public String index(HttpServletRequest request) {
        List<MetaPO> metas = metaService.getMetas(Types.LINK.getType());
        request.setAttribute("links", metas);
        return "admin/links";
    }
}
